let getById=function(id){
    return document.getElementById(id);
}
let listLi=getById("listUl").children;
let boxLi=getById("boxUl").children;
for(let i=0;i<listLi.length;i++)
{
    listLi[i].setAttribute("index",i);
    listLi[i].onclick=function()
    {
        for(let j=0;j<listLi.length;j++)
        {
            listLi[j].removeAttribute("class");
        }
        this.className="current";
        let number=this.getAttribute("index");
        for(let k=0;k<boxLi.length;k++)
        {
            boxLi[k].removeAttribute("class");
        }
        boxLi[number].className="show";
    }
}

//注销登录
$(".loginout").on('click',function (e) {
    e.preventDefault();
    $.ajax({
        type:"get",
        url:"http://localhost:8080/loginout",
        success:function (data) {
            alert(data.msg);
        },
        fail:function () {
            alert("服务器繁忙")
        },
        complete:function () {
            window.location.replace("http://localhost:8080/tologin");
        }
    })
});

//跳转到首页
$(".index").on('click',function (e) {
    window.location.replace("http://localhost:8080/index");
});
